From 14c0ed8bae2b83b4da97f443f188970c3a9a1707 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 6 Sep 2015 15:04:19 -0400 Subject: [PATCH] builder: Convert to g_object_notify_by_pspec This avoids pspec lookup overhead in g_object_notify. --- gtk/gtkbuilder.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index 02c2cdabc8..5849cbe23f 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -242,8 +242,11 @@ static GType gtk_builder_real_get_type_from_name (GtkBuilder *builder, enum { PROP_0, PROP_TRANSLATION_DOMAIN, + LAST_PROP }; +static GParamSpec *builder_props[LAST_PROP]; + struct _GtkBuilderPrivate { gchar *domain; @@ -283,13 +286,14 @@ gtk_builder_class_init (GtkBuilderClass *klass) * * Since: 2.12 */ - g_object_class_install_property (gobject_class, - PROP_TRANSLATION_DOMAIN, - g_param_spec_string ("translation-domain", - P_("Translation Domain"), - P_("The translation domain used by gettext"), - NULL, - GTK_PARAM_READWRITE)); + builder_props[PROP_TRANSLATION_DOMAIN] = + g_param_spec_string ("translation-domain", + P_("Translation Domain"), + P_("The translation domain used by gettext"), + NULL, + GTK_PARAM_READWRITE); + + g_object_class_install_properties (gobject_class, LAST_PROP, builder_props); } static void @@ -1496,7 +1500,7 @@ gtk_builder_set_translation_domain (GtkBuilder *builder, g_free (builder->priv->domain); builder->priv->domain = new_domain; - g_object_notify (G_OBJECT (builder), "translation-domain"); + g_object_notify_by_pspec (G_OBJECT (builder), builder_props[PROP_TRANSLATION_DOMAIN]); } /** -- 2.30.2